<template>
  <div>
    <h1>users:</h1>
    <ul>
      <li v-for="(item,index) in list" :key="index">{{item.name}}</li>
    </ul>
  </div>
</template>

<script>
import {mapState} from 'vuex'
export default {
  layout: "main",
  async fetch({ $axios, store }) {
    const { data } = await $axios.get("http://localhost:3333/users/user-list");
    store.commit('users/SET_LIST',data.data)
  },
  computed:{
    ...mapState('users',['list'])
  }
};
</script>

<style scoped>
</style>